<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">小程序列表</div>
                </div>
                <div class="widget-body am-fr">
                    <div class="am-scrollable-horizontal am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped
                         tpl-table-black am-text-nowrap">
                            <thead>
                            <tr>
                                <th>APP_ID</th>
                                <th>LOGO</th>
                                <th>名称</th>
                                <th>电话</th>
								<th>来源</th>
                                <th>授权</th>
								<th>版权</th>
								<th>版本</th>
								<th>到期</th>
                                <th>创建</th>
                                <th>管理</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!$list->isEmpty()): foreach ($list as $item): ?>
                                <tr>
                                    <td class="am-text-middle"><?= $item['wxapp_id'] ?></td>
                                    <td class="am-text-middle">
                                        <a href="<?= $item['head_img']?$item['head_img']:'./assets/store/img/wechatapp.png' ?>" title="点击查看大图" target="_blank">
                                            <img src="<?= $item['head_img']?$item['head_img']:'./assets/store/img/wechatapp.png' ?>" width="50" height="50" alt="小程序图片">
                                        </a>
                                    </td>
                                    <td class="am-text-middle">
                                        <p class="item-title"><?= $item['app_name']?$item['app_name']:'--' ?></p>
                                    </td>
                                    <td class="am-text-middle"><?= $item['phone']?$item['phone']:'--' ?></td>
									<td class="am-text-middle"><?= $item['source']['text'] ?></td>
                                    <td class="am-text-middle">
										<span class="<?= $item['is_empower']['value'] === 0 ? 'x-color-red'
                                                : 'x-color-green' ?>">
                                            <?= $item['is_empower']['text'] ?>
                                         </span>
									</td>
									<td class="am-text-middle">
                                            <span class="j-state am-badge x-cur-p  <?= $item['is_copyright']['value'] == 1 ? ' am-badge-success'
                                                : ' am-badge-warning' ?>" 
                                                 data-id="<?= $item['wxapp_id'] ?>"
                                                 data-status="<?= $item['is_copyright']['value'] ?>">
                                            <?= $item['is_copyright']['text'] ?>
                                            </span>
                                    </td>
									<td class="am-text-middle"><?= $item['app_type']['text'].' - '.$item['shop_mode']['text'] ?></td>
									<td class="am-text-middle"><?= $item['expire_time']['text'] ?></td>
                                    <td class="am-text-middle"><?= $item['create_time'] ?></td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
											<a href="<?= url('wxapp/appLogin',['wxapp_id' => $item['wxapp_id']])?>" target="_blank">
                                                管理登录
                                            </a>
                                            <a href="javascript:;" class="item-delete tpl-table-black-operation-del"
                                               data-id="<?= $item['wxapp_id'] ?>">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="11" class="am-text-center">暂无记录</td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><?= $list->render() ?> </div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
		
		// 状态
        $('.j-state').click(function () {
            // 验证权限
            if (!"1") {
                return false;
            }
            var data = $(this).data();
            layer.confirm('确定要' + (parseInt(data.status) === 1 ? '关闭' : '开启') + '用户自定义版权？'
                , {title: '友情提示'}
                , function (index) {
                    $.post("index.php?s=/admin/wxapp/copyright"
                        , {wxapp_id: data.id}
                        , function (result) {
                            result.code === 1 ? $.show_success(result.msg, result.url)
                                : $.show_error(result.msg);
                        });
                    layer.close(index);
                });

        });

        // 删除元素
        var url = "<?= url('wxapp/delete') ?>";
        $('.item-delete').delete('wxapp_id', url);

    });
</script>

